dnl Process this file with autoconf to produce a configure script.

AC_INIT(configure.in)
AM_INIT_AUTOMAKE(w3live-gui, 0.9)
AM_MAINTAINER_MODE
AM_CONFIG_HEADER(config.h)

AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC
AC_PROG_INSTALL
AC_PROG_RANLIB

GNOME_COMPILE_WARNINGS

# Yeah, I actually need to check for w3c-libwww
AC_ARG_WITH(www_lib,
	AC_HELP_STRING([--with-www_lib=<path>],[prefix of w3c-libwww headers]),
	[WWW_LIB_DIR=$with_www_lib],
	[WWW_LIB_DIR="/usr/local/include/w3c-libwww"])
AC_SUBST(WWW_LIB_DIR)

#	I should include this program with the distribution
AC_ARG_WITH(rx,
	[AC_HELP_STRING([--with-rx=<path>],[prefix of RX library headers])],
	[RX=$with_rx],
	[RX="/usr/local/include/rx"])
AC_SUBST(RX)

# Checks for the necessity of -lnsl -lsocket
tcl_checkBoth=0
AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
if test "$tcl_checkSocket" = 1; then
	AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", tcl_checkBoth=1)
fi
if test "$tcl_checkBoth" = 1; then
	tcl_oldLibs="$LIBS"
	LIBS="$LIBS -lsocket -lnsl"
	AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS="$tcl_oldLibs"])
fi
AC_CHECK_FUNC(gethostbyname, ,
	AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))

# Check for pthread peculiarities
#ACX_PTHREAD
#LIBS="$PTHREAD_LIBS $LIBS"
#CFLSGS="$CFLAGS $PTHREAD_CFLAGS"
#CC="$PTHREAD_CC"

pkg_modules="libgnomeui-2.0"
PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
AC_SUBST(PACKAGE_CFLAGS)
AC_SUBST(PACKAGE_LIBS)

GRAPHPACK=`pwd`/graphpack-1.0/src
AC_SUBST(GRAPHPACK)

WEBLOGLIB=`pwd`/webloglib-1.0/src
AC_SUBST(WEBLOGLIB)

W3LD=`pwd`/libw3ld
AC_SUBST(W3LD)

GETTEXT_PACKAGE=w3live
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE")

AC_CHECK_HEADERS([string.h])
AC_CHECK_HEADERS([unistd.h])

AC_C_CONST

dnl Add the languages which your application supports here.
ALL_LINGUAS=""
AM_GLIB_GNU_GETTEXT

AC_OUTPUT([
Makefile
po/Makefile
graphpack-1.0/Makefile
graphpack-1.0/src/Makefile
webloglib-1.0/Makefile
webloglib-1.0/src/Makefile
libw3ld/Makefile
src/Makefile
])

